//一,设置幻灯片参数
var slideindex = 1;
photo(slideindex)
//定义切换函数 


function photo(n) {
    var d2img = document.getElementsByClassName("d2img");
    if (n < 1) { slideindex = 3 }
    if (n > d2img.length) { slideindex = 1 }
    for(var i =0;i < d2img.length;i++){
        d2img[i].style.display = "none"
    }
    d2img[slideindex - 1].style.display = "block"; 
    
}
//定义左右置换函数
function a(n){
    photo(slideindex +=n);
}
//定义原点滚动函数
function span(n){
    photo(slideindex = n)
}
//二,设置图片弹出
var l1 = document.querySelector(".l1")
var l2 = document.querySelector(".l2")
var l3 = document.querySelector(".l3")
var l1div = document.querySelector(".l1div")
var l2div = document.querySelector(".l2div")
var l3div = document.querySelector(".l3div")
var sp1 = document.getElementsByClassName("sp1");
l1.onclick = function(){
    l1div.style.display = "block"
}
l2.onclick = function(){
    l2div.style.display = "block"
}
l3.onclick = function(){
    l3div.style.display = "block"
}
sp1[0].onclick = function(){
    l1div.style.display = "none"
}
sp1[1].onclick = function(){
    l2div.style.display = "none"
}
sp1[2].onclick = function(){
    l3div.style.display = "none"
}
//三，点击开始阅读
var btn = document.getElementById("btn");
var reading = document.getElementById("reading");
btn.onclick = function(){
   
    reading.style.width =100 + "%"
}
var sp2 = document.querySelector(".sp2");
sp2.onclick = function(){
    reading.style.width = 0 + "%"
}
//四，显示时间
var headsp3 = document.querySelector(".headsp3");
function gettime(){
    var times = new Date();
    var hours = times.getHours()
    var minutes = times.getMinutes()
    var seconds = times.getSeconds()
    var time = hours + ":" +minutes +":" + seconds
    headsp3.innerHTML = time
    setTimeout(()=>{gettime()},500)
}
gettime()

//进场动画删除
var beginani = document.getElementsByClassName("begin-animate")[0];
setTimeout(()=>{
    beginani.style.display = "none"
},3000) 




